package com.companyName.sample.common.exception;

/**
 * 系统错误
 */
public class SystemException extends RuntimeException {

    private static final long serialVersionUID = 1326999319998531620L;

    private SystemExceptionType error;

    private String message;

    /**
     * @param error 错误码
     */
    public SystemException(final SystemExceptionType error) {
        this.error = error;
    }

    /**
     * @param error   错误码
     * @param message 错误信息
     */
    public SystemException(final SystemExceptionType error, final String message) {
        this.error = error;
        this.message = message;
    }

    /**
     * @param error 错误码
     * @param cause 异常
     */
    public SystemException(final SystemExceptionType error,
                           final Throwable cause) {
        super(cause);
        this.error = error;
    }


    /**
     * 默认构造,禁止使用
     */
    @SuppressWarnings("unused")
    private SystemException() {
        throw new IllegalAccessError("禁止调用该构造函数");
    }
}
